/**
* @Description: WoShop商城
* @Author: 梧桐
* @Copyright: 武汉一一零七科技有限公司©版权所有
* @Link: www.wo-shop.net
* @Contact: QQ:2487937004
*/
<!-- 我的评价 -->
<template>
  <view class="page">
    <view class="content">
      <!-- 全部订单 -->
      <view class="list">
        <view class="listItem"  v-for="(comment,index) in commentList" :key="index"  @click="getnav('/pagesB/seller/orderDetails?order_num=' +comment.ordernumber)">
          <image class="orderStatusImg" :src="comment.filter==4 ? imgStaticUrl + 'images/icon-orderSuccess.png' : ''" />
          <view class="orderStatus">
            <view class="orderNo f24 c9">{{$t('订单编号')}}:{{comment.ordernumber}}</view>
          
          </view>
          <view class="goods">
            <u-image class="goodsPic" mode="aspectFill" width="160" height="160" border-radius="15"
            	:src="comment.goodsinfo.thumb_url?comment.goodsinfo.thumb_url:imgSTATICURL+'images/img-goodsNull@2x.png'">
            </u-image>
            
            <view class="goodsInfo">
              <view class="goodsName f32 c3">{{comment.goodsinfo.goods_name}}</view>
              <view class="totalPrice f24 c6">{{$t('共')}}{{comment.goodsinfo.goods_num}}{{$t("件宝贝,应付")}}<text class="priceNum">{{$t('¥')}}{{comment.total_price}}</text></view>
            </view>
          </view>
        
        </view>
      </view>
    </view>
    <loadMore :loadingType="loadingType"></loadMore>
  </view>
</template>

<script>

import uniRate from '@/components/uni-rate/uni-rate.vue';

export default {
  components: {
    uniRate,
  },
  data() {
    return {
      imgStaticUrl: this.STATICURL,
      commentList:[],
      page:1,
      delSrc:''
    }
  },
  onLoad(){
    
    let params = {
      size: "5",
      page: 1,
      filter:9
    };
    this.getCartApraiseList(params);
  },
  
  onReachBottom() {
    
    let params = {
      size: "5",
      page: 1,
      filter:9
    };
    this.loadMoreFunc(params);
  },
  onPullDownRefresh() {
    this.page = 1
    this.$nextTick(() => {
      this.getCartApraiseList({
        size: "5",
        page: 1,
        filter:9
      }, true);
    })
    
  },
  methods: {
    
    
    getCartApraiseList(data, refresh) {
      if (this.page == 1 ) {
        this.$loading();
      }
      this.$http.getShopperOrderList(data).then(res => {
        if (res.status === 200) {
          this.$hideLoading();
          if (refresh) {
            this.commentList = res.data;
            this.loadingType = 0;
            return false
          }
          if (res.data.length == 0) {

            this.loadingType = 2;
            return false;
          }
          this.commentList = this.commentList.concat(res.data);
          this.loadingType = 0;
        }
        // uni.stopPullDownrefrash();
      }).catch(() => {
        // uni.stopPullDownrefrash();
      })
    },
    
    
    loadMoreFunc: function (params) {
      // 加载函数
      
      if (this.loadingType == 1 || this.loadingType == 2) {
        return false;
      }
      this.loadingType = 1;

      ++this.page;
      params.page = this.page;
      
      this.$nextTick(() => {
        this.getCartApraiseList(params);
      })
    },
    deleteOrder(index) {
      this.$showModal({ content: this.$t('确认删除该评价')+"？" }).then(res => {
        if (res.confirm) {
          
        }
      });
    },
    close(index1, index2) {
      uni.showModal({
        content: this.$t('是否删除本条信息')+'？',
        success: (res) => {
          if (res.confirm) {
            this.newsList[index1].data.splice(index2, 1);
          }
        }
      })
    },
    preview: function(urls, urlsId) {
      uni.previewImage({
        current: urlsId, //当前显示的 图片
        indicator: "number",
        urls: urls // 预览图片的列表
      });
    }
  }
};
</script>

<style lang="less" scoped>


page {
  background: #f4f4f4;
}
.page{
  .listItem{
    background-color: #ffffff;
    margin: 30upx;
    border-radius: 20upx;
    padding: 30upx;
    position: relative;
  }
  .orderStatusImg{
    position:absolute;
    top: 0upx;
    right: 14upx;
    width: 208upx;
    height: 142upx;
  }
  .goods{
    display: flex;
    margin-top: 10upx;
    .goodsPic{
      flex-shrink: 0;
    }
    .goodsInfo{
      margin-left: 18upx;
      display: flex;
      justify-content: space-between;
      flex-direction: column;
      .priceNum{
        color: #FA3E3F;
        font-size: 36upx;
        font-weight: 600;
        margin-left: 8upx;
      }
    }
  }
}

</style>
